package com.wen.common.config;


import com.wen.common.filter.ExceptionFilter;
import com.wen.common.filter.TestFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;

import javax.annotation.Resource;

/**
 * 过滤器配置
 */
//@Configuration
public class FilterConfig {

    @Resource
    private TestFilter testFilter;
    @Autowired
    private ExceptionFilter exceptionFilter;


    @Bean
    public FilterRegistrationBean testFilterRegistration() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(exceptionFilter);
//        registration.addUrlPatterns("/filter/*");
        registration.setName("exceptionFilter");
        registration.setOrder(1);
        return registration;
    }

}
